/**
 * 
 */
package com.yidu.erp.service.apply;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.yidu.common.Tools;
import com.yidu.erp.dao.BeyondApplyMapper;
import com.yidu.erp.model.BeyondApply;

/**
 * @author Administrator
 *
 */
@Service
public class ApplyServiceImp implements BeyondApplyService{
	@Resource
	private BeyondApplyMapper BeyondApplyMapper;
	@Override
	public int deleteByPrimaryKey(String annexId) {
		return BeyondApplyMapper.deleteByPrimaryKey(annexId);
	}



	@Override
	public BeyondApply selectByPrimaryKey(String annexId) {
		
		return BeyondApplyMapper.selectByPrimaryKey(annexId);
	}

	@Override
	public int updateOrAdd(BeyondApply annex) {
		int rows=0;
		if(Tools.isEmpty(annex.getApplyId())){
			annex.setIsva(1);
			rows=BeyondApplyMapper.insertSelective(annex);
		}else{
			annex.setIsva(1);
			rows=BeyondApplyMapper.updateByPrimaryKeySelective(annex);
		}
		return rows;
	}

	@Override
	public Map<String, Object> selectAll(Map<String, Object> param) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("data", BeyondApplyMapper.selectAll(param));
		map.put("count", BeyondApplyMapper.findAllRowCount(param));
		map.put("code", 0);
		map.put("msg", 0);
		return map;
	}



	@Override
	public int update(BeyondApply applyId) {
		return BeyondApplyMapper.update(applyId);
	}

}
